<template>
<!--    历史坐标页面-->
    <div>
        {{$store.state.token}}
        <van-nav-bar
                left-arrow
                title="历史坐标"
                left-text="返回"
                @click-left="onClickLeft"
        />
       <div class="index">
    <input type="file" name="main" id="main" value="" accept="image/png, image/jpeg, image/gif, image/jpg" @change="uploadImg($event)">
    <img :src="imgsrc">	
	</div>	
    </div>
</template>

<script>

    export default {
        name: "history",
        data(){
            return{
                imgsrc:'',
            }
        },
        methods:{
          uploadImg(e){
        var file = e.target.files[0]
        if (!/\.(gif|jpg|jpeg|png|bmp|GIF|JPG|PNG)$/.test(e.target.value)) {
            this.$vux.toast.text('图片类型必须是.gif,jpeg,jpg,png,bmp中的一种', 'middle')
            return false
        }
        var reader = new FileReader()
        reader.readAsDataURL(file)
        reader.onload = (e) => {
            this.imgsrc= e.target.result
            console.log("图片地址" + e.target.result)
            //提交到后台相关略
        }
    },
            onClickLeft() {
               this.$router.go(-1)
            },
        }
    }
</script>

<style scoped>

</style>